// api/index.js
// 统一导出所有API模块

// 请求基础方法和Token管理
import {
  request,
  get,
  post,
  put,
  del,
  upload,
  download,
  saveTokenInfo,
  getToken,
  getRefreshToken,
  clearTokenInfo,
  isTokenExpired
} from './request';

// 认证相关API
import * as auth from './auth';

// 对话相关API
import * as dialogue from './dialogue';

// 单词学习相关API
import * as vocab from './vocab';

// 聊天相关API
import * as chat from './chat';



// 统计相关API
import * as statistics from './statistics';

// 任务管理相关API
import * as task from './task';

// 单词学习相关API
import * as word from './word';

// 导出所有API
export {
  // 基础方法
  request,
  get,
  post,
  put,
  del,
  upload,
  download,
  
  // Token管理
  saveTokenInfo,
  getToken,
  getRefreshToken,
  clearTokenInfo,
  isTokenExpired,
  
  // 业务模块API
  auth,
  dialogue,
  vocab,
  chat,
  statistics,
  task,
  word
};

// 导出统一的api对象（兼容login.vue的导入）
export const api = {
  auth,
  dialogue,
  vocab,
  chat,
  statistics,
  task,
  word,
  request,
  get,
  post,
  put,
  del,
  upload,
  download
};

// 添加调试日志，确保auth模块正确加载
console.log('API模块加载状态:', {
  authExists: !!auth,
  getUserInfoExists: typeof auth.getUserInfo === 'function',
  updateUserInfoExists: typeof auth.updateUserInfo === 'function'
});